﻿using FluentValidation;
using Nop.Admin.Models.Directory;
using Nop.Core.Domain.Directory;
using Nop.Data;
using Nop.Services.Localization;
using Nop.Web.Framework.Validators;

namespace Nop.Admin.Validators.Directory
{
	public partial class DepartmentValidator : BaseNopValidator<DepartmentModel>
	{
		public DepartmentValidator(ILocalizationService localizationService, IDbContext dbContext)
		{
			RuleFor(x => x.Name).NotEmpty().WithMessage("部门名称不能为空");
			RuleFor(x => x.Abbr).NotEmpty().WithMessage("部门编码不能为空");

			SetDatabaseValidationRules<Department>(dbContext);
		}
	}
}